{extend name="public:layout" /}
{block name="title"}评价管理{/block}
{block name="head"}
<style>
    i{cursor:pointer}
</style>
{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 评价列表</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <form class="form-inline" method="post" id="searchForm">
                    <input type="hidden" name="status" id="status" value="{$query.status|default=-1}" />
                    <div class="form-group">
                        <select class="form-control" name="field">
                            <option value="buyer_username" {eq name="query.field" value="buyer_username"}selected{/eq}>用户名</option>
                            <option value="order_sn" {eq name="query.field" value="order_sn"}selected{/eq}>订单号</option>
                            <option value="geval_content" {eq name="query.field" value="geval_content"}selected{/eq}>评价内容</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <input class="form-control" name="keyword" value="{$query.keyword}" type="text" placeholder="检索关键词">
                    </div>
                    <button type="submit" class="btn btn-info">
                        <i class="fa fa-search"></i> 搜索
                    </button>
                    <a class="btn btn-white" href="{:url('index')}">
                        <i class="fa fa-trash"></i> 清空
                    </a>
                </form>
            </div>
            <ul class="nav nav-tabs" id="tab_search">
                <li data-status="-1" onclick="setStatus(this)" {eq name="query.status" value="-1"}class="active"{/eq}><a href="javascript:;">所有评价</a></li>
                <li data-status="0" onclick="setStatus(this)" {eq name="query.status" value="0"}class="active"{/eq}><a href="javascript:;">未审核</a></li>
                <li data-status="1" onclick="setStatus(this)" {eq name="query.status" value="1"}class="active"{/eq}><a href="javascript:;">已审核</a></li>
                <li data-status="2" onclick="setStatus(this)" {eq name="query.status" value="2"}class="active"{/eq}><a href="javascript:;">未回复</a></li>
                <li data-status="3" onclick="setStatus(this)" {eq name="query.status" value="3"}class="active"{/eq}><a href="javascript:;">已回复</a></li>
            </ul>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="50">#</th>
                    <th>商品名称</th>
                    <th>评价内容</th>
                    <th>评价人</th>
                    <th>评价时间</th>
                    <th>状态</th>
                    <th width="120">操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo.geval_id}</td>
                    <td>{$vo.goods_name} {$vo.sku_name}</td>
                    <td>{:msubstr($vo.geval_content, 0, 30)}</td>
                    <td>{$vo.buyer_username}</td>
                    <td>{$vo.geval_time|date="Y-m-d H:i",###}</td>
                    <td>{$vo['geval_status']==1?'已审核':'未审核'}</td>
                    <td>
                        <a href="{:url('edit',['geval_id'=>$vo['geval_id']])}">查看/回复</a>
                        <a href="javascript:;" onclick="doAction(this);"
                           data-msg="确认删除吗？" data-url="{:url('del')}" data-params="geval_id={$vo.geval_id}">删除</a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
            <div class="page-bar">{$list->render()}</div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    //选取商品类型
    function setStatus(obj) {
        var status = $(obj).data('status');
        $('#status').val(status);
        $('#searchForm').submit();
    }
</script>
{/block}